package online.shenme.day04.studentManage.dao;

import online.shenme.day04.studentManage.domain.Student;

import java.util.ArrayList;

public class StudentDaoImpl implements StudentDao {
    ArrayList<Student> students = new ArrayList<>();

    @Override
    public boolean add(Student student) {
        return students.add(student);
    }

    @Override
    public boolean delete(String id) {
        if (findIndexByI(id)>=0){
            students.remove(findIndexByI(id));
            return true;
        }else {
            return false;
        }
    }

    @Override
    public ArrayList<Student> all() {
        return students;
    }
}
